<?php

namespace App\model\agent;

use Illuminate\Database\Eloquent\Model;

/**
 * App\model\agent\Agent
 *
 * @property int $id
 * @property string|null $mobile
 * @property string|null $name
 * @property int $department_id 部门id
 * @property int|null $position_id 职位id
 * @property string|null $avatar 头像
 * @property string|null $header_address
 * @property string|null $address
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereAvatar($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereDepartmentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereHeaderAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereMobile($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent wherePositionId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property int|null $status
 * @property-read \App\model\agent\AgentDepartment $department
 * @property-read \App\model\agent\AgentPositon|null $position
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereStatus($value)
 * @property string|null $fendian_name 店名称
 * @property int|null $is_zong 总部分部
 * @property string|null $lat
 * @property string|null $lng
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereFendianName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereIsZong($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereLat($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereLng($value)
 * @property int|null $is_default
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereIsDefault($value)
 * @property string|null $qrcode
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\agent\Agent whereQrcode($value)
 */
class Agent extends Model
{
    protected $table='agent';
    const STATUS_DISPLAY=1; //正常
    const STATUS_NODISPLAY=0;

    const ZONG =1 ;//'总店'
    const FENIDAN =0 ;//'分店'
    /**
     * 部门
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function department(){
        return $this->belongsTo(AgentDepartment::class,'department_id');
    }

    /**
     * 职位
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function position(){
        return $this->belongsTo(    AgentPositon::class,'position_id');
    }
}
